from drg_group.yinchuan_2023.Base import message,intersect,SS_VALID
from drg_group.yinchuan_2023.DRG import MDCC_DRG

def group(record):
  adrg_zd=["C44.100x002","D18.000x804","D21.003","D22.100","D22.100x004","D23.100x001","D23.100x002","D23.302","H00.000x001","H00.001","H00.002","H00.003","H00.100","H01.802","H02.000","H02.000x004","H02.003","H02.004","H02.100","H02.300","H02.400","H02.501","H02.503","H02.600","H02.800x011","H02.802","H02.803","H02.812","H02.901","H04.300x004","H04.300x005","H04.302","H04.303","H04.401","H04.402","H04.503","H04.505","H04.506","H04.509","H04.601","H04.801","H05.801","H11.000","H11.401","H16.000","H25.000x003","H25.100","H25.900","H33.504","H43.100","H49.800x002","H49.805","H49.806","H49.900","H50.000x002","H50.000x004","H50.001","H50.005","H50.006","H50.007","H50.100x002","H50.100x004","H50.102","H50.103","H50.104","H50.105","H50.106","H50.200","H50.200x004","H50.200x006","H50.202","H50.301","H50.400","H50.402","H50.405","H50.801","H50.802","H50.803","H50.807","Q10.000","Q10.200","Q10.303","Q10.306","Q85.900x046","S00.100x001","S00.100x006","S01.101","S05.100x004"]
  adrg_zd1=[]
  adrg_ss=["08.0100","08.0902","08.2000x005","08.2000x006","08.2000x009","08.2000x010","08.2001","08.2100","08.2100x001","08.2100x004","08.2200x003","08.2201","08.2300x001","08.2400x001","08.3101","08.3200x001","08.3200x003","08.3300x001","08.3400x001","08.3500","08.3600x002","08.3700","08.3800","08.4202","08.4203","08.4302","08.4401","08.4402","08.4901","08.4902","08.5101","08.5200x002","08.5900x004","08.5900x005","08.5901","08.5902","08.6100x004","08.6102","08.7001","08.7200x001","08.7400x001","08.8101","08.8102","08.8600x002","08.8700","08.8902","08.8903","08.9300x001","08.9901","09.0x00x001","09.4100","09.4100x001","09.4200","09.4300","09.4401","09.4404","09.4405","09.4900x002","09.5300","09.6x00x006","09.6x01","09.6x02","09.7300x001","09.7300x004","09.7301","09.8100x004","09.8101","15.1100","15.1200","15.1300","15.1900x001","15.2200","15.2901","15.3x01","15.3x02","15.4x01","15.5x00","15.6x00","15.7x01","86.2200x011"]
  adrg_ss1=[]
  adrg_ss2=[]
  dept_list=[]
  if True and record.zdList[0] in adrg_zd and record.ssList and record.ssList[0] in adrg_ss and record.ssList and intersect(record.ssList,adrg_ss):
    message('符合CD1入组条件，匹配规则：主诊断匹配、主手术匹配、某一手术匹配')
    
    if MDCC_DRG.CD19_group(record):
      return 'CD19'

    return 'CD1'
  else:
    return ''

